A better method for "Close Regions Gaps" #385
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The actual method for "Close Region Gaps" can be improved.
Indeed, in the current code, each region is stretched of "pull back length" to the left,
the region on the left is stretched to overlap this one of "Fade Length".
The problem arises when using this method after split a region at onsets and snap to grid all new regions (Rhytme ferret).
If after "split at Onsets", a gap between two regions is bigger than "Pull Back Length", then the right region will be stretched of Pull Back Lenght to the left, and the left region will be stretched to the right until overlap the right one. And what can we ear on the right side of the left region ? The attack present at the beggining of the right region.
To avoid this, I propose this code which retains the same behavior except that it never stretch the left region to the right. If the left region is not close enought, the right one will be stretched to the left until the end of the left one. This avoids double attacks.
So, we can rename "Pull Back Length", in "Minimum Pull Back Lenght" and set it by defaut to 10ms instead of 30ms, by experience it seems reasonable for drums or guitars.
Also, the code I propose uses truely the fade duration defined by user instead of a simple overlap (for audio regions only). If "Fade Length" is set on 0ms, the default fade will be used (64samples), I think it's good the set it to 0 by default.
To test this, take an audio region of rhytmic guitar or drum, apply Rhytme Ferret, analyze region, split region at Onsets, select all new regions and "snap to grid". Then use "Close Gaps".